package com.bbznb.controller;

import com.bbznb.common.Result;
import com.bbznb.entity.UserData;
import com.bbznb.service.UserDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.math.BigDecimal;

@RestController
@RequestMapping("/api/user/profile")
public class UserDataController {
    @Autowired
    private UserDataService userDataService;
    @GetMapping
    public Result getUserData() {
        UserData userData = userDataService.getUserData();
        return Result.build(200, "操作成功", userData);
    }
    @PutMapping()
    public Result updateUserData(@RequestParam(value = "age", required = false) Integer age,@RequestParam(value = "file", required = false) MultipartFile file) {
        userDataService.updateUserData(age, file);
        return Result.build(200, "操作成功", null);
    }
}
